package com.zhika.zishi.internet;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.zhika.zishi.beans.recommend.RecommendStrategyBean;
import com.zhika.zishi.constant.OthersConstant;

/**
 * Created by shi-02 on 2015/5/6.
 */
public class GetInternet {

    //攻略
    public static final int STRATEGY_HANDLER_WHAT=111;

    public static final String STRATEGY_BUNDLE = "strategy_bundle";

    /**
     * 推荐首页--攻略
     */
    public static void getRecommendStrategy(Handler handler){

        //网络请求攻略的数据
        String jsonData = "";

        //解析json数据并传给activity
        parseRecommendStrategyJson(jsonData,handler);

    }

    /**
     * 解析推荐攻略的json数据
     * @param jsonData
     * @param handler
     */
    private static void parseRecommendStrategyJson(String jsonData,Handler handler){

        //解析jsonData
        //解析后得RecommendStrategyBean
        RecommendStrategyBean bean = new RecommendStrategyBean();
        bean.setHomepageType("strategy");
        bean.setHobbyStr("类型");
        bean.setStrategy("攻略标题攻略标题攻略标题");
        bean.setContentStr("攻略内容攻略内容攻略内容攻略内容攻略内容攻略内容攻略内容");
        bean.setPictureUrlStr(OthersConstant.PICTURE_1);
        bean.setCommentNumStr("44");
        bean.setCollectNumStr("22");
        bean.setLikeNumStr("111");

        //给activity传数据
        Message message = Message.obtain();
        message.what = STRATEGY_HANDLER_WHAT;
        Bundle bundle = new Bundle();
        bundle.putSerializable(STRATEGY_BUNDLE,bean);
        message.setData(bundle);
        handler.sendMessage(message);

    }
}
